package com.bm.user.consumer;

import com.bm.common.RabbitMqConstants;
import com.bm.tools.service.IEmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class UserConsumer {
    @Autowired
    private IEmailService iEmailService;
    @RabbitListener(queues = RabbitMqConstants.MQ_MAIL_QUEUE)
    public void emailCon(String msg){
        log.debug("邮箱消费：",msg);
        iEmailService.sendEmail("1248024770@qq.com",
                "验证码测试",
                msg);
    }

    @RabbitListener(queues = RabbitMqConstants.MQ_PHONE_QUEUE)
    public void phoneCon(String msg){
        log.debug("短信消费：",msg);
    }
}
